package com.swu.dto;

import jakarta.validation.Valid;
import jakarta.validation.constraints.*;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

@Data
public class MedicalRecordDTO {
    // 医疗机构信息
    @NotBlank(message = "医疗机构名称不能为空")
    private String orgName;
    
    @NotBlank(message = "组织机构编码不能为空")
    private String orgCode;
    
    // 患者基本信息
    @NotBlank(message = "病案号不能为空")
    private String medicalRecordId;
    
    private String healthCard;
    
    @NotBlank(message = "患者姓名不能为空")
    private String name;
    
    @NotBlank(message = "性别不能为空")
    private String gender;
    
    @NotNull(message = "出生日期不能为空")
    private LocalDate birthDate;
    
    @NotNull(message = "年龄不能为空")
    @Min(value = 0, message = "年龄不能小于0")
    private Integer age;
    
    private Integer infantAgeMonths;
    
    @NotBlank(message = "国籍不能为空")
    private String nationality;
    
    @NotBlank(message = "出生地不能为空")
    private String birthPlace;
    
    @NotBlank(message = "籍贯不能为空")
    private String originPlace;
    
    @NotBlank(message = "民族不能为空")
    private String ethnicity;
    
    @NotBlank(message = "证件号码不能为空")
    private String idNumber;
    
    private String occupation;
    
    @NotNull(message = "婚姻状况不能为空")
    @Min(value = 1, message = "婚姻状况代码不正确")
    @Max(value = 9, message = "婚姻状况代码不正确")
    private Integer maritalStatus;
    
    @NotBlank(message = "现住址不能为空")
    private String currentAddress;
    
    @NotBlank(message = "电话不能为空")
    private String phone;
    
    @NotBlank(message = "邮编不能为空")
    @Pattern(regexp = "\\d{6}", message = "邮编格式不正确")
    private String postalCode;
    
    private String registeredAddress;
    private String workUnit;
    private String workPhone;
    
    @NotBlank(message = "联系人姓名不能为空")
    private String contactName;
    
    @NotBlank(message = "联系人关系不能为空")
    private String contactRelation;
    
    @NotBlank(message = "联系人电话不能为空")
    private String contactPhone;
    
    @NotNull(message = "血型不能为空")
    @Min(value = 1, message = "血型代码不正确")
    @Max(value = 6, message = "血型代码不正确")
    private Integer bloodType;
    
    @NotNull(message = "Rh因子不能为空")
    @Min(value = 1, message = "Rh因子代码不正确")
    @Max(value = 4, message = "Rh因子代码不正确")
    private Integer rhFactor;
    
    // 住院信息
    @NotNull(message = "住院次数不能为空")
    @Min(value = 1, message = "住院次数必须大于0")
    private Integer admissionCount;
    
    @NotNull(message = "医疗付费方式不能为空")
    @Min(value = 1, message = "医疗付费方式代码不正确")
    @Max(value = 9, message = "医疗付费方式代码不正确")
    private Integer paymentMethod;
    
    @NotNull(message = "入院途径不能为空")
    @Min(value = 1, message = "入院途径代码不正确")
    @Max(value = 9, message = "入院途径代码不正确")
    private Integer admissionPath;
    
    @NotNull(message = "入院时间不能为空")
    private LocalDateTime admissionTime;
    
    @NotBlank(message = "入院科别不能为空")
    private String admissionDept;
    
    private String ward;
    
    private String transferDept;
    
    @NotNull(message = "出院时间不能为空")
    private LocalDateTime dischargeTime;
    
    @NotBlank(message = "出院科别不能为空")
    private String dischargeDept;
    
    @NotNull(message = "实际住院天数不能为空")
    @Min(value = 1, message = "实际住院天数必须大于0")
    private Integer actualDays;
    
    @NotBlank(message = "门(急)诊诊断不能为空")
    private String erDiagnosis;
    
    private String erDiagCode;
    
    // 诊断信息
    @NotBlank(message = "主要诊断不能为空")
    private String mainDiagnosis;
    
    @NotBlank(message = "主要诊断疾病编码不能为空")
    private String mainDiagnosisCode;
    
    @NotNull(message = "主要诊断入院病情不能为空")
    @Min(value = 1, message = "入院病情代码不正确")
    @Max(value = 4, message = "入院病情代码不正确")
    private Integer mainDiagnosisStatus;
    
    // 出院信息
    @NotNull(message = "离院方式不能为空")
    @Min(value = 1, message = "离院方式代码不正确")
    @Max(value = 9, message = "离院方式代码不正确")
    private Integer dischargeMethod;
    
    private String receivingOrg;
    
    @NotNull(message = "31天再住院计划不能为空")
    @Min(value = 1, message = "再住院计划代码不正确")
    @Max(value = 2, message = "再住院计划代码不正确")
    private Integer readmissionPlan;
    
    private String readmissionReason;
    
    // 费用信息
    @NotNull(message = "总费用不能为空")
    @DecimalMin(value = "0.0", message = "总费用不能小于0")
    private BigDecimal totalCost;
    
    private BigDecimal selfPay;
    
    private BigDecimal generalMedicalService; // 一般医疗服务费
    private BigDecimal generalTreatmentOperation; // 一般治疗操作费
    private BigDecimal nursingFee; // 护理费
    private BigDecimal otherFee; // 其他费用
    private BigDecimal pathologyDiagnosis; // 病理诊断费
    private BigDecimal laboratoryDiagnosis; // 实验室诊断费
    private BigDecimal imagingDiagnosis; // 影像学诊断费
    private BigDecimal clinicalDiagnosis; // 临床诊断项目费
    private BigDecimal nonSurgicalTreatment; // 非手术治疗项目费
    private BigDecimal surgicalTreatment; // 手术治疗费
    private BigDecimal rehabilitation; // 康复费
    private BigDecimal tcmTreatment; // 中医治疗费
    private BigDecimal westernMedicine; // 西药费
    private BigDecimal chinesePatentMedicine; // 中成药费
    private BigDecimal chineseHerbalMedicine; // 中草药费
    private BigDecimal bloodFee; // 血费
    private BigDecimal albumin; // 白蛋白类制品费
    private BigDecimal globulin; // 球蛋白类制品费
    private BigDecimal disposableExamMaterials; // 检查用一次性医用材料费
    private BigDecimal disposableTreatMaterials; // 治疗用一次性医用材料费
    private BigDecimal disposableSurgeryMaterials; // 手术用一次性医用材料费
    private BigDecimal otherCosts; // 其他费用
    
    // 医疗团队信息
    @NotBlank(message = "科主任不能为空")
    private String departmentHead;
    
    @NotBlank(message = "主治医师不能为空")
    private String attending;
    
    @NotBlank(message = "住院医师不能为空")
    private String resident;
    
    @NotBlank(message = "责任护士不能为空")
    private String nurse;
    
    @NotNull(message = "病案质量等级不能为空")
    @Min(value = 1, message = "病案质量等级代码不正确")
    @Max(value = 3, message = "病案质量等级代码不正确")
    private Integer qualityGrade;
    
    @NotBlank(message = "质控医师不能为空")
    private String qcDoctor;
    
    @NotBlank(message = "质控护士不能为空")
    private String qcNurse;
    
    @NotNull(message = "质控日期不能为空")
    private LocalDate qcDate;
} 